roc_obj_list <- map(colnames(df)[-c(1, length(df))], function(g) {
    library(pROC)
    roc_obj <- roc(factor(df$group), df[[g]])
    roc_obj
})

names(roc_obj_list) <- colnames(df)[-c(1, length(df))]
colors <- ggsci::pal_jama()(7)

pdf(file.path(od, v, str_c("Figure_", "all_g", "_roc.pdf")), width = 4, height = 4.2)
plot(0, 0,
    type = "n", xlim = c(1, 0), ylim = c(0, 1),
    xlab = "Specificity", ylab = "Sensitivity"
)
# 绘制ROC曲线
for (i in 1:length(roc_obj_list)) {
    plot.roc(roc_obj_list[[i]], col = colors[i], add = T, lwd = 2)
}
auc_values <- sapply(roc_obj_list, auc)
# 创建图例标签
legend_labels <- sprintf("%s (AUC %.3f)", names(auc_values), auc_values)

# 添加图例
legend("bottomright",
    legend = legend_labels,
    col = colors,
    bty = "n",
    cex = .7,
    lwd = 2
)
# 添加对角线
abline(a = 1, b = -1, lty = 2, col = "gray40", lwd = 1.5)
auc_values <- sapply(roc_obj_list, auc)
dev.off()